
package tfoundation;

import java.util.ListIterator;

import tfoundation.feed.BodyDisplay;
import tfoundation.feed.DisplayFeed;
import tfoundation.ui.UI;
import tfoundation.world.World;

public class TimeFlowController implements Runnable
{
	public boolean run = true;
	private final World world;
	private final DisplayFeed feed;

	private final UI ui;
	public int period = 0;

	public TimeFlowController(World world, DisplayFeed feed, UI ui)
	{
		this.feed = feed;
		this.world = world;
		this.ui = ui;

		this.period = 60;
	}

	@Override
	public void run()
	{

		this.run = true;
		do
		{
			this.world.update();

			this.feed.readWorld(world.hero);

			try
			{
				Thread.sleep(this.period);
			}
			catch (InterruptedException e)
			{
			}

			this.ui.refresh();
		}
		while (this.run);
	}
}
